widget: Set :focus on focus children
authorTimm Bäder <mail@baedert.org>
Tue, 11 Jul 2017 16:20:48 +0000 (18:20 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:16 +0000 (21:27 -0400)
gtk/gtkwidget.c
gtk/theme/Adwaita/_common.scss
gtk/theme/Adwaita/gtk-contained-dark.css
gtk/theme/Adwaita/gtk-contained.css

index dee81a70a0a6acf48285ce957635c9f78152d550..b966dc57dcd6fc383aaa82b155ec52576c671545 100644 (file)
@@ -15343,7 +15343,6 @@ gtk_widget_snapshot (GtkWidget   *widget,
           cairo_destroy (cr);
         }
 
-
       if (gtk_widget_has_visible_focus (widget))
         {
           gtk_snapshot_offset (snapshot, margin.left, margin.top);
@@ -15632,6 +15631,12 @@ gtk_widget_set_focus_child (GtkWidget *widget,
       g_return_if_fail (gtk_widget_get_parent (child) == widget);
     }
 
+  if (priv->focus_child)
+    gtk_widget_unset_state_flags (priv->focus_child, GTK_STATE_FLAG_FOCUSED);
+
+  if (child)
+    gtk_widget_set_state_flags (child, GTK_STATE_FLAG_FOCUSED, FALSE);
+
   g_set_object (&priv->focus_child, child);
 
   if (GTK_IS_CONTAINER (widget))
index b604c146dab79353a72c03c310fe33413085d501..dea9211a1825db2a4fc2e4307061c1e3df556fcd 100644 (file)
@@ -10,6 +10,10 @@ $button_transition: all 200ms $ease-out-quad;
 * {
   padding: 0;
 
+  -gtk-secondary-caret-color: $selected_bg_color
+}
+
+*:focus {
   // We use the outline properties to signal the focus properties
   // to the adwaita engine: using real CSS properties is faster,
   // and we don't use any outlines for now.
@@ -19,8 +23,6 @@ $button_transition: all 200ms $ease-out-quad;
   outline-offset: -3px;
   outline-width: 1px;
   -gtk-outline-radius: 2px;
-
-  -gtk-secondary-caret-color: $selected_bg_color
 }
 
 
index 826937db40663ed1f9436f9d4f39783cad0404e3..e066a6668ca953b673fb2f5c509b5e53320506e8 100644 (file)
@@ -1,4 +1,6 @@
-* { padding: 0; outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; -gtk-secondary-caret-color: #215d9c; }
+* { padding: 0; -gtk-secondary-caret-color: #215d9c; }
+
+*:focus { outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; }
 
 /*************** Base States * */
 .background { color: #eeeeec; background-color: #33393b; }
index d94b3db65369d970a04516df35e329c63a699d85..82da84514bde065313b1d98042176ec28ffdbaf8 100644 (file)
@@ -1,4 +1,6 @@
-* { padding: 0; outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; -gtk-secondary-caret-color: #4a90d9; }
+* { padding: 0; -gtk-secondary-caret-color: #4a90d9; }
+
+*:focus { outline-color: alpha(currentColor,0.3); outline-style: dashed; outline-offset: -3px; outline-width: 1px; -gtk-outline-radius: 2px; }
 
 /*************** Base States * */
 .background { color: #2e3436; background-color: #e8e8e7; }